Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve #1060

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

resolve #1060

wants to merge 2 commits into from

Conversation

DankevichMisha
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Thank you for your hard work on this pull request! 😊 While you've made great progress, there are a few critical issues that need to be addressed before we can approve it:

  1. Logger Configuration: The task requires configuring the logger with appenders for both File and Console, which is currently missing. This is crucial for meeting the task requirements.

  2. Informative Log Messages: The log messages need to be more informative. For example, instead of logger.info("Login method was called"), consider including parameters or context to make the logs more useful.

  3. User Initialization: The user variable in Main.java is declared but not initialized. This can lead to issues if the login method throws an exception. Ensure it is initialized to null or handle the login failure scenario more gracefully.

  4. Order Constructor: The Order(Long orderId) constructor does not initialize the orderId field. Make sure to set this.orderId = orderId; to properly initialize it.

  5. .gitignore Configuration: The syntax for ignoring the logs directory is incorrect. It should be logs/ instead of /logs. This ensures that log files are not pushed to GitHub.

Please address these issues to ensure the code meets all specified requirements. Once these are resolved, we can move forward with approval. Keep up the great work, and don't hesitate to reach out if you have any questions! 🚀

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review button in the Reviewers tab.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your submission! 🎉 You've made great progress, but there are a few areas that need attention to enhance your code's functionality and maintainability. Here are some key points to address:

  1. Logger Configuration: It's crucial to configure the logger with appenders for both File and Console as per the task requirements. This ensures that logs are properly recorded and accessible.

  2. Informative Log Messages: Enhance your log messages by including relevant parameters or context. For example, in the login method, consider adding the login parameter to provide more insight into the log entry.

  3. Order Constructor: Ensure that the orderId field is initialized in the Order(Long orderId) constructor. This is essential for the correct functioning of your order management.

  4. .gitignore Syntax: Correct the syntax for ignoring the logs directory by using logs/. This prevents unnecessary log files from being pushed to GitHub.

  5. User Initialization in Main.java: Initialize the user variable to avoid potential issues if the login method throws an exception.

These improvements will not only align your code with the task requirements but also enhance its overall quality. Keep up the good work, and continue learning from these experiences to refine your skills! 🚀

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

@@ -1,3 +1,4 @@
.idea/*
*.iml
target/*
/logs

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The syntax for ignoring the logs directory is incorrect. It should be logs/ instead of /logs. This ensures that log files are not pushed to GitHub.


public class Main {
private static final Logger logger = LogManager.getLogger(Main.class);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logger configuration is missing appenders for both File and Console. According to the task description, you need to configure the logger with these appenders .


public class Main {
private static final Logger logger = LogManager.getLogger(Main.class);

public static void main(String[] args) {
AuthenticationService authenticationService = new AuthenticationServiceImpl();
User user;
try {
user = authenticationService.login("bob", "1234");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log message in the login method should be more informative. Consider including parameters or context to make the logs more useful, as suggested in the checklist .

@@ -7,7 +7,7 @@ public class Order {
private List<Product> products;
private Long userId; // the identifier of user who complete the order

public Order() {
public Order(Long orderId) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The orderId field is not initialized in this constructor. You should set this.orderId = orderId; to properly initialize it.

@Override
public User login(String login, String password) throws AuthenticationException {
//TODO: add corresponding log message about method login was called
logger.info("Login method was called");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log message 'Login method was called' is not very informative. Consider including the login parameter or other context to make the log more useful, as suggested in the checklist.

@Override
public Order completeOrder(Long userId) {
// TODO: add log message about method completeOrder was called
logger.info("CompleteOrder method was called");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log message 'CompleteOrder method was called' is not very informative. Consider including the userId parameter or other context to make the log more useful, as suggested in the checklist.

@@ -24,7 +28,7 @@ private List<Product> getAllProductsFromShoppingCart(Long userId) {
Product macBook = new Product("MacBook Air 2020", BigDecimal.valueOf(1399));
Product xiaomi = new Product("Xiaomi 12", BigDecimal.valueOf(499));
List<Product> products = List.of(iphone, macBook, xiaomi);
// TODO: add log message about successful fetched data from DB
logger.info("Successful fetched data from DB");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log message 'Successful fetched data from DB' could be more informative. Consider including details about the userId or the number of products fetched to provide more context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants